package com.datuo.dtf.admin.service;

import com.datuo.dtf.mapper.MenuMapper;
import com.datuo.dtf.model.Menu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 菜单
 */
@Service
public class MenuService {

    @Autowired
    private MenuMapper menuMapper;

    /**
     * 根据用户ID查询菜单
     * @param userId
     * @return
     */
    public List<Menu> findByUserId(Long userId) {
        if(userId==1){
            return menuMapper.selectAll();
        }
        return menuMapper.findByUserId(userId);
    }
}
